package com.ee.bruscar.configuration.hint;

import java.util.ArrayList;
import java.util.List;

public class DataModelHint
{
	@SuppressWarnings("unchecked")
	private Class clazz;
	private List<MemberHint> memberHints;

	@SuppressWarnings("unchecked")
	public DataModelHint(Class clazz)
	{
		this.clazz = clazz;
		memberHints = new ArrayList<MemberHint>();
	}


	public String getClassName()
	{
		return clazz.getSimpleName();
	}

	public List<MemberHint> getMemberHints()
	{
		return memberHints;
	}

	public void addMemberHint(MemberHint memberHint)
	{
		memberHints.add(memberHint);
	}


	public boolean supports(String className)
	{
		return clazz.equals( className );
	}


	public String getHint(String setterName)
	{
		for( MemberHint hint : memberHints )
		{
			if( hint.supports( setterName ))
			{
				return hint.getHint();
			}
		}
		return setterName;
	}
}
